<template>
	<div id="app">
		<nut-tabbar v-if="nutshow" class="bottomBar" @tab-switch="tabSwitch3" :tabbar-list="tabList3" :bottom="true"></nut-tabbar>
		<router-view/>
	</div>
</template>

<style>
	#app {
		font-family: Avenir, Helvetica, Arial, sans-serif;
		-webkit-font-smoothing: antialiased;
		-moz-osx-font-smoothing: grayscale;
		color: #2c3e50;
		margin: 0 auto;
		padding: 0;
	}

	body {
		background: #f6f6f6;
		margin: 0 auto;
		padding: 0;
	}

	#nav {
		padding: 30px;
	}

	#nav a {
		font-weight: bold;
		color: #2c3e50;
	}

	#nav a.router-link-exact-active {
		color: #42b983;
	}

	.bottomBar{


	}

	.bottomBar>a{
		transform: scale(0.8);
	}
</style>
<script>
    export default {
        data() {
            return {
                tabList3: [
                    {
                        'tabTitle': '主页',
                        'curr': true,
                        'icon': 'http://img13.360buyimg.com/uba/jfs/t1/29316/38/1115/3203/5c0f3d61E35d0c7da/9e557f2cb5c9dab6.jpg',
                        'activeIcon': 'http://img20.360buyimg.com/uba/jfs/t1/9996/36/8646/4833/5c0f3d61E7c1b7e0f/c98ad61124172e93.jpg',
                        'href': '###'
                    },
                    {
                        'tabTitle': '分类',
                        'curr': false,
                        'icon': 'http://img12.360buyimg.com/uba/jfs/t1/25443/23/1062/4600/5c0f3d61E2e9f1360/c9b3421fe18614e2.jpg',
                        'activeIcon': 'http://img20.360buyimg.com/uba/jfs/t1/19241/12/1048/8309/5c0f3d61E17ed5a56/c3af0964cade47f8.jpg',
                        'href': '###'
                    },
                    {
                        'tabTitle': '发现',
                        'curr': false,
                        'icon': 'http://img13.360buyimg.com/uba/jfs/t1/10361/35/4713/4643/5c0f3d62E437a3c94/273fd0fb90798f03.jpg',
                        'activeIcon': 'http://img14.360buyimg.com/uba/jfs/t1/26604/35/1073/7896/5c0f3d61Eb9f5f184/5f01c938abe4216d.jpg',
                        'href': '###'
                    },
                    {
                        'tabTitle': '购物车',
                        'curr': false,
                        'num': 2,
                        'icon': 'http://img11.360buyimg.com/uba/jfs/t1/14848/18/1066/3723/5c0f41bdE9f2a38fe/e6ed6768717297fb.jpg',
                        'activeIcon': 'http://img30.360buyimg.com/uba/jfs/t1/17538/16/1070/6214/5c0f41bdE4bc9a1db/74cf978e5015454b.jpg',
                        'href': '###'
                    },
                    {
                        'tabTitle': '我的',
                        'curr': false,
                        'icon': 'http://img20.360buyimg.com/uba/jfs/t1/20004/20/1045/3620/5c0f3d61Eaaec1670/9e59db63983b7b9f.jpg',
                        'activeIcon': 'http://img14.360buyimg.com/uba/jfs/t1/23967/14/1072/6714/5c0f3d61E0ad8991e/8f741953f6e38f15.jpg',
                        'href': '###'
                    }
                ]

            }
        },
        methods: {
            tabSwitch3: function (value, index) {
                if (index == 0) {
                    this.$router.push('/')
                } else if (index == 1) {
                    this.$router.push('goodstype')
                } else if (index == 2) {
					this.$router.push('search')
                } else if (index == 3) {
                    this.$router.push('shopingCar')
                } else if (index == 4) {
                    this.$router.push('me')
                }
            }
        },
      computed:{
          nutshow:function ()
          {

            let path=this.$route.path;

            if(path=='/'||path=='/goodstype'||path=='/shopingCar'||path=='/me')
            {
            return true;
            }else
            {
              return false;
            }
          }
      },
      watch:{
        $route(to,from){
          if(to.path=='/goodstype')
          {
            this.tabList3[0].curr=false;
            this.tabList3[2].curr=false;
            this.tabList3[3].curr=false;
            this.tabList3[4].curr=false;
            this.tabList3[1].curr=true;
          }else if(to.path=='/shopingCar')
          {
            this.tabList3[0].curr=false;
            this.tabList3[1].curr=false;
            this.tabList3[2].curr=false;
            this.tabList3[4].curr=false;
            this.tabList3[3].curr=true;
          }else if(to.path=='/me')
          {
            this.tabList3[0].curr=false;
            this.tabList3[1].curr=false;
            this.tabList3[2].curr=false;
            this.tabList3[3].curr=false;
            this.tabList3[4].curr=true;



          }
        }
      }

    }
</script>
